/*
 * by: chenming
 * date: 2023/4/20
 * desc: 多语言相关hooks
 * */

import { computed } from 'vue';
import { useLangStore } from '@/store/index';

export function setLang(lang: object) {
  const langStore = useLangStore();
  langStore.setLang(lang);
}

export function changeLang(longEnv: string) {
  const langStore = useLangStore();
  langStore.getLanguages(longEnv);
}
// 通过模块名获取语言配置
export function getLang(moduleName: string) {
  const langStore = useLangStore();
  const LANG = computed(() => {
    // @ts-ignore
    return langStore.getterLang[moduleName];
  });
  return LANG;
}
